package com.salt;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;

/**
 * @Description 网关启动类
 * @Author salt
 * @Date 2020/6/15 10:45
 * @Version 1.0
 */
//@EnableZuulWebSocket
//@EnableWebSocketMessageBroker
@Configuration
@EnableZuulProxy
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients
public class GateWayApp {

    public static void main(String[] args){
        SpringApplication.run(GateWayApp.class, args);
    }

    /*@Bean
    public TomcatServletWebServerFactory mbeddedServletContainerFactory() {
        TomcatServletWebServerFactory tomcatEmbeddedServletContainerFactory = new TomcatServletWebServerFactory ();
        tomcatEmbeddedServletContainerFactory.addConnectorCustomizers(connector ->{
            connector.setMaxParameterCount(Integer.MAX_VALUE);
        });
        return tomcatEmbeddedServletContainerFactory;
    }*/

    /*@Bean
    public ServletWebServerFactory mbeddedServletContainerFactory() {
        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory ();
        tomcat.addConnectorCustomizers(connector ->{
            connector.setMaxParameterCount(Integer.MAX_VALUE);
        });
        tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
        return tomcat;
    }

    private Connector createHTTPConnector() {
        Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
        //同时启用http（9100）、https（9200）两个端口
        connector.setScheme("http");
        connector.setSecure(false);
        connector.setPort(9100);  // http
        connector.setRedirectPort(9200);  // https
        return connector;
    }*/
}
